import request from '@/utils/request'

// 查询采购商品信息列表
export function listPlanInfo(query) {
  return request({
    url: '/purs/planInfo/list',
    method: 'get',
    params: query
  })
}

// 查询采购商品信息详细
export function getPlanInfo(prodInfoId) {
  return request({
    url: '/purs/planInfo/' + prodInfoId,
    method: 'get'
  })
}

// 新增采购商品信息
export function addPlanInfo(data) {
  return request({
    url: '/purs/planInfo',
    method: 'post',
    data: data
  })
}

// 修改采购商品信息
export function updatePlanInfo(data) {
  return request({
    url: '/purs/planInfo',
    method: 'put',
    data: data
  })
}

// 删除采购商品信息
export function delPlanInfo(prodInfoId) {
  return request({
    url: '/purs/planInfo/' + prodInfoId,
    method: 'delete'
  })
}


//批量新增采购商品信息
export function addBatchPlanInfo(data) {
  return request({
    url: '/purs/planInfo/insertBatchPlanInfo',
    method: 'post',
    data: data
  })
}

//批量修改或新增
export function updateOrInsertPlanInfo(data) {
  return request({
    url: '/purs/planInfo/updateOrInsertPlanInfo',
    method: 'post',
    data: data
  })
}


//批量删除
export function deletePlanInfos(data) {
  return request({
    url: '/purs/planInfo/deletePlanInfos',
    method: 'post',
    data: data
  })
}

//获取最新id
export function getPlanInfoNewId() {
  return request({
    url: '/purs/planInfo/getPlanInfoNewId',
    method: 'get',
  })
}


//根据采购编号获取商品详情
export function getPlanInfoListByBindCode(bindCode) {
  return request({
    url: '/purs/planInfo/getPlanInfoListByBudgets/'+bindCode,
    method: 'get',
  })
}
